//***********************************************************************
//	File:		Entity.h
//	Author:		
//	Course:		SGP 1405
//	Purpose:	
//***********************************************************************
//***********************************************************************
//	Purposfully left blank for all comments regarding this file 
//	
//	
//	
//***********************************************************************



#pragma once
#include "IEntity.h"
#include "../SGD Wrappers/SGD_Geometry.h"
#include "../SGD Wrappers/SGD_Handle.h"
#include "../SGD Wrappers/SGD_Event.h"
#include "../SGD Wrappers/SGD_Listener.h"

class Entity :
	public IEntity
{
public:
	Entity() = default;
	virtual ~Entity() = default;

	/**********************************************************/
	// Entity Types:
	// this is an enum used for event handling and 
	//GetType for all classes derived from it
	enum EntityType {ENT_BASE, ENT_ABILITY_BASE, ENT_CONCUSSIONBLAST, 
					 ENT_CONFUSION_GAS, ENT_CRYONET, ENT_NPC_BASE, ENT_NURSE,
					 ENT_ENGINEER, ENT_STATIONARY_BASE, ENT_HEALTHPACK,
					 ENT_OBSTACLE_BASE, ENT_ELECTRIC_FENCE, ENT_FIRETRAP, 
					 ENT_CONCRETEBARRIER, ENT_PROJECTILE_BASE, ENT_FLAME,
					 ENT_HEATSEEKER, ENT_TESLA, ENT_MOVEABLE, ENT_EXPLOSIVEBARREL,
					 ENT_WOODENCRATE, ENT_METALCRATE, ENT_GRENADE, ENT_ENEMY_BASE,
					 ENT_SPIDERMINE, ENT_BASHER, ENT_RAIDER, ENT_STRIKER, 
					 ENT_PWNER, ENT_DISRUPTOR, ENT_ANKLEBITER, ENT_TANKOSAURUS,
					 ENT_MECHATROOPER, ENT_MOTHERBRAIN, ENT_PLAYER, ENT_BULLET, 
					 ENT_PLAYERTOO, ENT_SNIPER_BULLET};

	/**********************************************************/
	// Interface:
	//	- virtual functions for children classes to override
	virtual void				Update(float dt);
	virtual void				Render(void);

	virtual	SGD::Rectangle		GetRect(void)	const;
	virtual int					GetType(void)	const	{ return ENT_BASE; }
	virtual void				HandleCollision(const IEntity* pOther);
	

	/**********************************************************/
	//AddRef and Release for Reference counting
	virtual void				AddRef(void); 
	virtual void				Release(void); 

	/**********************************************************/
	// Accessors:
	virtual SGD::HTexture		GetImage   (void) const { return m_hImage; }
	virtual SGD::Point			GetPosition(void) const { return m_ptPosition; }
	virtual SGD::Vector			GetVelocity(void) const { return m_vVelocity; }
	virtual SGD::Size			GetSize(void) const { return m_szSize; }
	virtual float				GetRotation(void) const { return m_fRotation; }

	/**********************************************************/
	// Mutators
	virtual void				SetImage(SGD::HTexture image) { m_hImage = image; }
	virtual void				SetPosition(SGD::Point pos) { m_ptPosition = pos; }
	virtual void				SetVelocity(SGD::Vector vel) { m_vVelocity = vel; }
	virtual void				SetSize(SGD::Size size) { m_szSize = size; }
	virtual void				SetRotation(float rot) { m_fRotation = rot; }

protected:
	SGD::HTexture	m_hImage		= SGD::INVALID_HANDLE;
	SGD::Point		m_ptPosition	= SGD::Point{ 0, 0 };
	SGD::Vector		m_vVelocity		= SGD::Vector{ 0, 0 };
	SGD::Size		m_szSize		= SGD::Size{ 0, 0 };
	float			m_fRotation		= 0.0f; // Radians

private:
	//Reference Counting
	unsigned int	m_unRefCount = 1; 

};

